#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>

using namespace std;
const int N = 1e5 + 5;

void transform(int ans, int P)
{
    int arr[N];
    int i = 0;
    while (ans)
    {
        arr[++i] = ans % P;
        ans /= P;
    }

    for (int j = i; j >= 1; j--)
    {
        if (arr[j] < 10)
            cout << arr[j];
        else
            cout << (char)('A' + arr[j] - 10);
    }
}

int main()
{
    int P = 0;
    cin >> P;
    for (int i = 1; i < P; i++)
    {
        for (int j = 1; j <= i; j++)
        {
            if (i < 10)
                cout << i;
            else
                cout << (char)('A' + i - 10);
            cout << "*";
            if (j < 10)
                cout << j;
            else
                cout << (char)('A' + j - 10);
            cout << "=";
            transform(i * j, P);
            cout << " ";

        }
        cout << "\n";
    }

    return 0;
}